package cn.brondfish.icedfish.database.system.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import cn.brondfish.icedfish.database.system.entity.SysUser;

@Dao
public interface SysUserDao {

    @Query("SELECT COUNT(*) FROM sys_user")
    public boolean countUsers();

    @Query("SELECT * FROM sys_user")
    public SysUser getUser();

    @Insert(onConflict = OnConflictStrategy.IGNORE)
    public void insert(SysUser user);

    @Update()
    public void update(SysUser user);

    @Query("UPDATE sys_user SET avatar = '', create_by = NULL, create_time = NULL, del_flag = '0', status = '0', email = NULL, nick_name = NULL, phonenumber = NULL, remark = NULL, sex = NULL, userId = 0, deptId = 0, user_name = NULL, token = ''")
    public void cleanUser();
}
